package com.cet.lxf.generic.test02;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-08-02 14:32
 **/
public class Main03 {
    public static void main(String[] args) {
        Pair03<Integer> pair = new Pair03<>(1, 2);
        System.out.println(add(pair));
    }

    private static int add(Pair03<? extends Number> p) {
        Number first = p.getFirst();
        Number last = p.getLast();
        return first.intValue() + last.intValue();
    }
}

class Pair03<T>{
    private T first;
    private T last;

    public Pair03(T first, T last) {
        this.first = first;
        this.last = last;
    }
    public T getFirst() {
        return first;
    }
    public T getLast() {
        return last;
    }
}
